//
//  LDTabHandeView.m
//  Gift
//
//  Created by 李迪 on 15/11/24.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "LDTabHandeView.h"
#import "ClassificationModel.h"

@interface LDTabHandeView ()

@end

@implementation LDTabHandeView

-(void)dealloc{
    [self.name release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {

        [self createLabel];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNot:) name:@"lidi" object:nil];
        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString *passWord = [user objectForKey:@"night"];
        if ([passWord isEqualToString:@"yes"]) {
            self.name.textColor = [UIColor whiteColor];
        }
    }
    return self;
}

- (void)handleNot:(NSNotification *)Not{
    NSString *passWord = [Not object];
    if ([passWord isEqualToString:@"yes"]) {
        self.name.textColor = [UIColor whiteColor];
    }else if ([passWord isEqualToString:@"no"]){
        self.name.textColor = [UIColor blackColor];
    }
}

- (void)createLabel{
    self.name = [[UILabel alloc]initWithFrame:CGRectMake(20, 0, 100, 30)];
    self.name.font = [UIFont systemFontOfSize:18];
    [self addSubview:self.name];
    
    
    [self.name release];
}





@end
